#ifndef UANALYSERCONTROLS_H
#define UANALYSERCONTROLS_H

#include <QtGui>
#include <QWidget>

class uAnalyserWidget;

//User interface class responsible for oscilloscope/analyser controls
class uAnalyserControls : public QWidget
{
    Q_OBJECT
public:
    uAnalyserControls(QWidget* parent );
    void adjustTimeBase(double time_sweep); //change time base to make trace occupy as much horizontal space as possible
    void showTriggerControls(bool); //show/hide oscilloscope signal trigger controls

    uAnalyserWidget *mainWidget; //upper level container for this class
    QVBoxLayout *containerLayout; //top level layout of this class
    QScrollArea *channelControlsScrollArea;
    QVBoxLayout *channelControlsLayout; //keeps channel group boxes inside channelControlsScrollArea

    //oscilloscope "triggering" controls.
    //In my opinion they should constitute the separate class along with the oscilloscope functionality from uAnalyserWidget
    QGroupBox *triggerControlsGroupBox;
    QGridLayout *triggerControlsLayout;
    QPushButton *triggerToggleButton;
    bool currentState; //oscilloscope RUN(1)/PAUSE(0);

    //Controls used in every mode of operation, for all channels
    //currently only timebase selection and grid/axis toggling
    QGroupBox *commonControlsGroupBox;
    QGridLayout *commonControlsLayout;
    QLabel *timeBaseLabel;
    QComboBox *timeBaseCombo;
    QLabel *timeBaseUnitLabel;
    QCheckBox *showAxes;
    QCheckBox *showGrid;

public slots:
    void setTimeBase(int i ); //sets time base using index of item from combo box
    void setOscilloscopeState(bool); //changes oscilloscope state between RUN(1)/PAUSE(0);
    void toggleOscilloscopeState() { setOscilloscopeState(!currentState); }
signals:
    void timeBaseChanged(double t_base); //sents new value of time base to main widget after new one was selected from combo box
};


#endif // UANALYSERCONTROLS_H
